﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            RangeValidator2.MaximumValue = DateTime.Now.ToString();

        }

        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            if (args.Value == "admin")
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (IsValid == true)
            {
                Literal1.Text = "注册成功！    ";
                
            }

            if (ful.HasFile == true)
            {
                string name = ful.FileName;
                if (name.EndsWith(".jpg") || name.EndsWith(".png") || name.EndsWith(".jpge"))
                {

                }
                else
                {
                    Response.Write("<scrip>alert('格式不正确！只能是jpg jpge png 文件！')</ scrip>");
                }
            }
            else
            {
                Response.Write("<scrip>alert('请选择文件！')</ scrip>");
            }
        }
    }
}